#define _CRT_SECURE_NO_WARNINGS 1



class Solution {
public:
    string twoStringCommonPrefixk(const string& str1, const string& str2)
    {
        int i = 0;
        while (i < str1.size() && i < str2.size() && str1[i] == str2[i]) i++;
        return str1.substr(0, i);
    }
    string longestCommonPrefix(vector<string>& strs) {
        string ans = strs[0];
        for (int i = 1; i < strs.size(); i++)
        {
            ans = twoStringCommonPrefixk(ans, strs[i]);
        }
        return ans;
    }
};